package exeption;

import java.util.List;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("游戏开始");
        try {
            //String list = null;
            //String list="a";
            String list="abc";
            System.out.println(list.length());
            //try中出现错误之后的代码都不会执行
            System.out.println("!!!!!!!!!");
        //}catch (NullPointerException e){
            //出现问题,接着走
          //  System.out.println("出现空指针,并解决了");
        //}catch (StringIndexOutOfBoundsException e){
            //System.out.println("出现下标腋界,并解决了");
        }catch (NullPointerException  | StringIndexOutOfBoundsException e){
            System.out.println("出现空指针和下标腋界,并解决了");
        }
        catch (Exception e){
            System.out.println("反正就是出拉一个错");
        }
        System.out.println("游戏结束");

    }
}
